home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_01 / the.h < prev    next >
C/C++ Source or Header  |  1993-11-23  |  26KB  |  787 lines

  1. /*
  2.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  3.  * Copyright (C) 1991-1993 Mark Hessling
  4.  *
  5.  * This program is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU General Public License as
  7.  * published by the Free Software Foundation; either version 2 of
  8.  * the License, or any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13.  * General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to:
  17.  *
  18.  *    The Free Software Foundation, Inc.
  19.  *    675 Mass Ave,
  20.  *    Cambridge, MA 02139 USA.
  21.  *
  22.  *
  23.  * If you make modifications to this software that you feel increases
  24.  * it usefulness for the rest of the community, please email the
  25.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  26.  * This software is going to be maintained and enhanced as deemed
  27.  * necessary by the community.
  28.  *
  29.  * Mark Hessling                     email: M.Hessling@gu.edu.au
  30.  * 36 David Road                     Phone: +61 7 849 7731
  31.  * Holland Park                      Fax:   +61 7 875 5314
  32.  * QLD 4121
  33.  * Australia
  34.  */
  35.  
  36. /*
  37. $Header: C:\THE\RCS\the.h 1.4 1993/09/01 16:27:20 MH Interim MH $
  38. */
  39.  
  40. #include "defines.h"
  41.  
  42. #if defined(USE_NCURSES)
  43. #   include <ncurses.h>
  44. #   define SYSVR32
  45. #else
  46. #   if defined(USE_EXTCURSES)
  47. #      include <cur00.h>
  48. #      define SYSVR32
  49. #      define A_COLOR
  50. #      define COLOR_BLACK        0
  51. #      define COLOR_BLUE        1
  52. #      define COLOR_GREEN        2
  53. #      define COLOR_CYAN        3
  54. #      define COLOR_RED        4
  55. #      define COLOR_MAGENTA        5
  56. #      define COLOR_YELLOW        6
  57. #      define COLOR_WHITE        7
  58.        typedef char bool;
  59. #      define chtype NLSCHAR
  60. #      define COLOR_PAIRS 64
  61.        extern chtype color_pair[COLOR_PAIRS];
  62. #      define COLOR_PAIR(n) color_pair[n]
  63. #      define wattrset(win,attr) xstandout(win,attr)
  64. #      define attrset(attr) xstandout(stdscr,attr)
  65. #      define nocbreak() nocrmode()
  66. #      define cbreak() crmode()
  67. #      define wnoutrefresh(win) wrefresh(win)
  68. #   else
  69. #      include <curses.h>
  70. #   endif
  71. #endif
  72.  
  73. #ifdef __OS2__
  74. #  undef MSDOS                 /* in case you are using MSC 6.0 for OS/2 */
  75. #  undef SYSV                  /* set in curses.h */
  76. #  undef BSD                   /* set in curses.h */
  77. #  define SYSVR32curses
  78. #  define SYSVR31curses
  79. #  define SYSVR3curses
  80. #  include <stdlib.h>
  81. #  include <memory.h>
  82. #  include <string.h>
  83. #  include <process.h>
  84. #  include <errno.h>
  85. #  include <ctype.h>
  86. #  include <sys\types.h>
  87. #  include <sys\stat.h>
  88. #  define         W_OK          02
  89. #  define         F_OK          00
  90. #  define         R_OK          04
  91. #  define ESLASH '\\'
  92. #  define ESTR_SLASH (char *)"\\"
  93. #  ifdef EMX
  94. #    define OSLASH '\\'
  95. #    define OSTR_SLASH (char *)"\\"
  96. #    define ISLASH '/'
  97. #    define ISTR_SLASH (char *)"/"
  98. #  else
  99. #    define OSLASH '/'
  100. #    define OSTR_SLASH (char *)"/"
  101. #    define ISLASH '\\'
  102. #    define ISTR_SLASH (char *)"\\"
  103. #  endif
  104. #  define CURRENT_DIR (char *)"."
  105. #  define FMODE (0)
  106. #  ifdef MSC
  107. /* the following 2 defines are to make MSC recognise the new names */
  108. /* of the following OS/2 calls */
  109. #    define DosSetDefaultDisk DosSelectDisk
  110. #    define DosQueryCurrentDisk DosQCurDisk
  111. #  endif
  112. #endif
  113.  
  114. #if defined(__MSDOS__) || defined(MSDOS)
  115. #  define SYSVR32curses
  116. #  define SYSVR31curses
  117. #  define SYSVR3curses
  118. #  undef SYSV                  /* set in curses.h */
  119. #  undef BSD                   /* set in curses.h */
  120. #  include <stdlib.h>
  121. #  include <memory.h>
  122. #  include <string.h>
  123. #  ifdef GO32
  124. #    include <dir.h>
  125. #  else
  126. #    include <process.h>
  127. #    include <direct.h>
  128. #  endif
  129. #  include <errno.h>
  130. #  include <io.h>
  131. #  include <ctype.h>
  132. #  include <sys\types.h>
  133. #  include <sys\stat.h>
  134. #  define         W_OK          02
  135. #  define         F_OK          00
  136. #  define         R_OK          04
  137. #  define ESLASH '\\'
  138. #  define ESTR_SLASH (char *)"\\"
  139. #  ifdef GO32
  140. #    define OSLASH '\\'
  141. #    define OSTR_SLASH (char *)"\\"
  142. #    define ISLASH '/'
  143. #    define ISTR_SLASH (char *)"/"
  144. #  else
  145. #    define OSLASH '/'
  146. #    define OSTR_SLASH (char *)"/"
  147. #    define ISLASH '\\'
  148. #    define ISTR_SLASH (char *)"\\"
  149. #  endif
  150. #  define CURRENT_DIR (char *)"."
  151. #  define FMODE (0)
  152. /*#define FMODE (S_IREAD | S_IWRITE)*/
  153. #endif
  154.  
  155. #ifdef SYSVR4
  156. #  undef BSD
  157. #  ifndef SYSV
  158. #    define SYSV
  159. #  endif
  160. #  include <ctype.h>
  161. #  include <unistd.h>
  162. #  define SYSVR4curses
  163. #  define SYSVR32curses
  164. #  define SYSVR31curses
  165. #  define SYSVR3curses
  166. #endif
  167.  
  168. #ifdef SYSVR32
  169. #  undef BSD
  170. #  ifndef SYSV
  171. #    define SYSV
  172. #  endif
  173. #  include <ctype.h>
  174. #  include <unistd.h>
  175. #  define SYSVR32curses
  176. #  define SYSVR31curses
  177. #  define SYSVR3curses
  178. #endif
  179.  
  180. #ifdef SYSVR31
  181. #  undef BSD
  182. #  ifndef SYSV
  183. #    define SYSV
  184. #  endif
  185. #  define SYSVR31curses
  186. #  define SYSVR3curses
  187. #endif
  188.  
  189. #ifdef SYSVR3
  190. #  undef BSD
  191. #  ifndef SYSV
  192. #    define SYSV
  193. #  endif
  194. #  define SYSVR3curses
  195. #endif
  196.  
  197. #ifdef SYSV
  198. #  undef BSD
  199. #  define SYSVcurses
  200. #  if !defined(ATT)
  201. #    include <stdlib.h>
  202. #    include <sys/file.h>
  203. #  endif
  204. #  include <memory.h>
  205. #  include <string.h>
  206. #  include <sys/types.h>
  207. #  include <sys/stat.h>
  208. #  define FMODE (0)
  209. #  define UNIX 1
  210. #endif
  211.  
  212.  
  213. #ifdef BSD
  214. #  include <stdlib.h>
  215. #  include <memory.h>
  216. #  include <string.h>
  217. #  include <sys/file.h>
  218. #  include <sys/types.h>
  219. #  include <sys/stat.h>
  220. #  define FMODE (0)
  221. #  define chtype short
  222. #  define UNIX 1
  223. #  define BSDcurses 1
  224. #  define NO_KEYPAD 1
  225. #  define attrset(attr) wattrset(stdscr,attr)
  226. #  ifdef linux
  227. #    include <unistd.h>
  228. #  endif
  229. #endif
  230.  
  231. #ifdef M_XENIX
  232. #  include <ctype.h>
  233. #  include <sys/types.h>
  234. #  include <sys/stat.h>
  235. #  include <memory.h>
  236. #  include <string.h>
  237. #  include <sys/file.h>
  238. #  define         F_OK          00
  239. #  define         W_OK          02
  240. #  define         R_OK          04
  241. #  define touchline(WIN,START,NUM)       touchwin(WIN)
  242. #  define FMODE (0)
  243. #  define UNIX 1
  244. #endif
  245.  
  246. #ifdef MINIX
  247. #  include <string.h>
  248. #  define short int
  249. #  define UNIX 1
  250. #endif
  251.  
  252. #ifdef UNIX
  253. #  define ESLASH '/'
  254. #  define ESTR_SLASH (char *)"/"
  255. #  define OSLASH '\\'
  256. #  define OSTR_SLASH (char *)"\\"
  257. #  define ISLASH ESLASH
  258. #  define ISTR_SLASH ESTR_SLASH
  259. #  define CURRENT_DIR (char *)"."
  260. #endif
  261.  
  262. #ifdef VMS
  263. #  include <string.h>
  264. #  include <file.h>
  265. #  include <types.h>
  266. #  include <stat.h>
  267. #  include <ctype.h>
  268. #  define         W_OK          02
  269. #  define         F_OK          00
  270. #  define         R_OK          04
  271. #  define ISLASH ']'
  272. #  define ISTR_SLASH (char *)"]"
  273. #  define OSLASH ISLASH
  274. #  define OSTR_SLASH ISTR_SLASH
  275. #  define ESLASH ISLASH
  276. #  define ESTR_SLASH ISTR_SLASH
  277. #  define CURRENT_DIR (char *)"[]"
  278. /*#define FMODE (S_IRWXU | S_IRGRP | S_IROTH)*/
  279. #  define FMODE (0)
  280. #  ifdef BSD
  281. #    define chtype short
  282. #    define BSDcurses 1
  283. #  endif
  284. #  define touchline(WIN,START,NUM)       touchwin(WIN)
  285. /* #define isdigit(c)   (_ctype[(c) + 1] & 2)
  286. #  define islower(c)   (_ctype[(c) + 1] & 8)
  287. #  define isupper(c)   (_ctype[(c) + 1] & 4)*/
  288. #  define NO_KEYPAD 1
  289. #endif
  290. /*---------------------------------------------------------------------*/
  291. /* End of OS-specific defines                                          */
  292. /*---------------------------------------------------------------------*/
  293.  
  294. #ifndef A_NORMAL
  295. /* Various video attributes */
  296. #ifdef BSD
  297. #define A_STANDOUT      _STANDOUT    /* for compatability with old curses */
  298. #define A_REVERSE       _STANDOUT    /* for compatability with old curses */
  299. #define A_UNDERLINE     0
  300. #define A_BLINK         0
  301. #define A_DIM           0
  302. #define A_BOLD          _STANDOUT
  303.  
  304. /* The next two are subject to change so don't depend on them */
  305. #define A_INVIS         0
  306. #define A_PROTECT       0
  307.  
  308. #define A_NORMAL        0
  309. #define A_CHARTEXT      0x007F
  310. #define A_ATTRIBUTES    ~A_CHARTEXT
  311. #define A_ALTCHARSET    0
  312.  
  313. #else
  314.  
  315. #define A_STANDOUT      000000200000L
  316. #define A_UNDERLINE     000000400000L
  317. #define A_REVERSE       000001000000L
  318. #define A_BLINK         000002000000L
  319. #define A_DIM           000004000000L
  320. #define A_BOLD          000010000000L
  321. #define A_ALTCHARSET    00010